from captcha.models import CaptchaStore


def verify(key: str, code: str) -> bool:
    """
    检查输入的验证码是否正确
    :param key:
    :param code:
    :return:
    """
    try:
        CaptchaStore.objects.get(response=code, hashkey=key).delete()
        return True
    except CaptchaStore.DoesNotExist:
        return False
